#!/usr/bin/env python3

import asyncio

from mcp.client.stdio import stdio_client
from mcp import ClientSession, StdioServerParameters

print('import')

# server-end params (using uv)
params = StdioServerParameters(
    command="uv",
    args=["run", "server.py"])

# using `python`
# params = StdioServerParameters(
#    command="python",
#    args=["server.py"])

print('set parames')

async def main():
    async with stdio_client(params) as (stdio, write):
        async with ClientSession(stdio, write) as session:

            print("init session")

            await session.initialize()

            resp = await session.call_tool("greeting", {"name": "World"}) # direct call tools
            print(f">>> {resp.content[0].text}")

#            resp = await session.list_tools()
#            for tool in resp.tools:
#                print(f"{tool.name}; {tool.inputSchema}")

print('define main')

if __name__ == "__main__":
    asyncio.run(main())
